#!/usr/bin/env python3
# _*_coding:utf-8_*_
# cockroach
# email:donnie.fan@foxmail.com

def consumer(name):
    print("包子来了")
    while True:
        baozi = yield
        print("来了%s包子，被%s吃了" % (baozi,name))


def producer(name):
    c = consumer(name)
    c2 = consumer(name)
    c.__next__()
    c2.__next__()
    print("开始吃包子了")
    for i in range(10):
        print("做了两个包子")
        c.send(i)
        c2.send(i)


producer("alex")




